class Payload:
    @property
    def json(self):
        return {}


class QuestionInfoPayload(Payload):
    __json = {
        "operationName": "questionData",
        "variables": {"titleSlug": "two-sum"},
        "query": '''query questionData($titleSlug: String!) {
  question(titleSlug: $titleSlug) {
    questionId
    questionFrontendId
    categoryTitle
    boundTopicId
    title
    titleSlug
    content
    translatedTitle
    translatedContent
    isPaidOnly
    difficulty
    likes
    dislikes
    isLiked
    similarQuestions
    contributors {
      username
      profileUrl
      avatarUrl
      __typename
    }
    langToValidPlayground
    topicTags {
      name
      slug
      translatedName
      __typename
    }
    companyTagStats
    codeSnippets {
      lang
      langSlug
      code
      __typename
    }
    stats
    hints
    solution {
      id
      canSeeDetail
      __typename
    }
    status
    sampleTestCase
    metaData
    judgerAvailable
    judgeType
    mysqlSchemas
    enableRunCode
    envInfo
    book {
      id
      bookName
      pressName
      source
      shortDescription
      fullDescription
      bookImgUrl
      pressImgUrl
      productUrl
      __typename
    }
    isSubscribed
    isDailyQuestion
    dailyRecordStatus
    editorType
    ugcQuestionId
    style
    exampleTestcases
    __typename
  }
}'''
    }

    def __init__(self, title_slog: str):
        self.title_slog = title_slog

    @property
    def json(self):
        j = self.__json.copy()
        j['variables']['titleSlug'] = self.title_slog
        return j


class QuestionListPayload(Payload):
    __json = {'query': '''
    query problemsetQuestionList($categorySlug: String, $limit: Int, $skip: Int, $filters: QuestionListFilterInput) {
  problemsetQuestionList(
    categorySlug: $categorySlug
    limit: $limit
    skip: $skip
    filters: $filters
  ) {
    hasMore
    total
    questions {
      acRate
      difficulty
      freqBar
      frontendQuestionId
      isFavor
      paidOnly
      solutionNum
      status
      title
      titleCn
      titleSlug
      topicTags {
        name
        nameTranslated
        id
        slug
      }
      extra {
        hasVideoSolution
        topCompanyTags {
          imgUrl
          slug
        }
      }
    }
  }
}''',
              "variables": {
                  "categorySlug": "",
                  "skip": 0, "limit": 50,
                  "filters": {}
              }
              }

    def __init__(self, categorySlug='', skip=0, limit=50, filters: dict = None):
        filters = filters if filters is not None else dict()

        self.category_slug = categorySlug
        self.skip = skip
        self.limit = limit
        self.filters = filters

    @property
    def json(self):
        variables = {
            "categorySlug": self.category_slug,
            "skip": self.skip, "limit": self.limit,
            "filters": self.filters,
        }

        j = self.__json.copy()
        j['variables'] = variables
        return j

class CodeInterpretPayload(Payload):
    def __int__(self,
                question_id: int, lang: str, typed_code: str,
                data_input: str,
                judge_type='small', test_mode=False, test_judger=''):
        self.question_id = question_id
        self.lang = lang
        self.typed_code = typed_code
        self.data_input = data_input
        self.judge_type = judge_type
        self.test_mode = test_mode
        self.test_judger = test_judger

    @property
    def json(self):
        return {
            "question_id": str(self.question_id),
            "lang": self.lang,
            "typed_code": self.typed_code,
            "data_input": self.data_input,
            "test_mode": self.test_mode,
            "judge_type": self.judge_type,
            "test_judger": self.test_judger,
        }


def test():
    from pprint import pprint

    ql = QuestionListPayload()
    pprint(ql.json)


if __name__ == '__main__':
    test()
